package cn.tsingyu.java.example;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexTest {
	public static void main(String[] args) {
		System.out.println(isIntNumber("9.1"));
	}
	//正整数
	public static boolean isIntNumber(String str){
		String regex = "^[1-9]\\d*$";
		return match(regex,str);		
	}
	private static boolean match(String regex,String str){
		Pattern p = Pattern.compile(regex);
		Matcher m = p.matcher(str);
		return m.matches();
	}
}
